package Slice

import (
	"fmt"
	"net/url"
	"strconv"
)

/**
map转为url参数
 */
func MapToUrlString(dataMap map[string]interface{}) string {
	if dataMap==nil{
		return "'"
	}
	param:=url.Values{}
	for k,v:=range dataMap{
		switch v.(type) {
		case int:
			param.Add(k, strconv.Itoa(v.(int)))
		case string:
			param.Add(k, v.(string))
		case float64:
			param.Add(k, fmt.Sprintf("%f", v.(float64)))
		}
	}
	return param.Encode()
}